﻿@model Lead2012.ViewModels.BaseViewModel

@{
    string className = string.Empty;

    var model = Model.Menu;
    

    if (model != null && model.MenuList != null && model.MenuList.Count > 0)
    {
        if (model.EnableMenuNavigation)
        {
		    <div class="tabs">
                <ul class="sf-menu">
                    @foreach (var item in model.MenuList)
                    {
                        className = (item.CurrentMenu) ? "active" : "";

                        if (item.SubItem != null && item.SubItem.Count > 0)
                        {                                    
                            <li class="@className"><a href="@item.LinkUrl">@item.LinkText</a>
                                <ul>
                                    @foreach (var sub in item.SubItem)
                                    {
                                        if (sub.SubItem != null && sub.SubItem.Count > 0)
                                        {
                                            <li><a href="@sub.LinkUrl">@sub.LinkText</a>
                                               @if (sub.SubItem != null && sub.SubItem.Count > 0)
                                               {
                                                   <ul>
                                                   @foreach (var temp in sub.SubItem)
                                                   {
                                                       <li><a href="@temp.LinkUrl">@temp.LinkText</a></li>
                                                   }
                                                   </ul>
                                               }
                                            </li>
                                        }
                                        else
                                        {
                                            if (@sub.LinkText.ToString().Equals("Help and Support")) {
                                                <li><a href="@sub.LinkUrl" target="_blank">@sub.LinkText</a></li>
                                            }
                                            else {
                                                <li><a href="@sub.LinkUrl">@sub.LinkText</a></li>
                                            }
                                        }
                                    }
                                </ul>
                            </li>
                        }
                        else
                        {
                            <li class="tab @className"><a href="@item.LinkUrl" class="top_link"><span>@item.LinkText</span></a></li>
                        }
                    }
            
                </ul>
            </div>
        }
        else
        {
            <div class="tabs">
                <ul class="sf-menu">
                    @foreach (var item in model.MenuList)
                    {
                        className = (item.CurrentMenu) ? "active" : "";
                        <li class="tab @className"><a href="javascript:void(0)" class="top_link"><span>@item.LinkText</span></a></li>
                    }
            
                </ul>
            </div>
        }
    }
}